assign_pages() has a return type of int, but only returns 0 or -1. As there
are two distinct failure cases, return a more meaningful error.
All caller currently use its boolean nature, so there is no resulting
change (yet).
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
unsigned int order,
unsigned int memflags)
{
+ int rc = 0;
unsigned long i;
spin_lock(&d->page_alloc_lock);
{
gdprintk(XENLOG_INFO, "Cannot assign page to domain%d -- dying.\n",
d->domain_id);
- goto fail;
+ rc = -EINVAL;
+ goto out;
}
if ( !(memflags & MEMF_no_refcount) )
gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
"%u > %u\n", d->domain_id,
d->tot_pages + (1 << order), d->max_pages);
- goto fail;
+ rc = -E2BIG;
+ goto out;
}
if ( unlikely(d->tot_pages == 0) )
page_list_add_tail(&pg[i], &d->page_list);
}
+ out:
spin_unlock(&d->page_alloc_lock);
- return 0;
-
- fail:
- spin_unlock(&d->page_alloc_lock);
- return -1;
+ return rc;
}